/*
 * HDOJ41006.cpp
 *
 *  Created on: 2016年8月7日
 *      Author: none
 */

//参考示例编写

#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;

const int CHANGE = 60;
const int H=12;
const int M=60;
const int S=60;

struct Range
{
	double a;
	double b;
};

Range intersection(Range x,Range y);
Range happyRange1(double x,double y);
Range happyRange2(double x,double y);

int D=0;

int main(void)
{
	int h,m;
	double sec_sum;
	cin>>D;
	while(D!=-1)
	{
		sec_sum=0;
		for(h=0;h<12;h++)
		{
			for(m=0;m<60;m++)
			{
				Range s[3][2];
				double a,b;
		    a=30.0*h - 5.5*m;    b=11.0/120;
				s[0][0]=happyRange1(a,b);            s[0][1]=happyRange2(a,b);

		    a=30.0*h + 0.5*m;    b=719.0/120.0;
		    s[1][0]=happyRange1(a,b);            s[1][1]=happyRange2(a,b);
		    a=6.0*m;              b=5.9;
		    s[2][0]=happyRange1(a,b);            s[2][1]=happyRange2(a,b);
						for(int i=0;i<2;i++)
						 for(int j=0;j<2;j++)
						 for(int k=0;k<2;k++)
						 {
						 Range tmp=intersection(intersection(s[0][i],s[1][j]),s[2][k]);
						 sec_sum+=tmp.b-tmp.a;

						 }
			}
		}

		printf("%.3f\n",sec_sum/(12*60*60)*100);
		cin>>D;
	}

}

Range intersection(Range x,Range y)
{
	Range temp;
	temp.a=max(x.a,y.a);
	temp.b=min(x.b,y.b);
	if(temp.a>temp.b)
		{temp.a=temp.b=0.0;}
	return temp;
}

Range happyRange1(double x,double y)
{
	Range temp;
	temp.a=(x+D)/y;
	temp.b=(x+360-D)/y;
	if (temp.a>temp.b) {
		temp.a=temp.b=0.0;
	}
	if(temp.a<0) temp.a=0;
	if(temp.b>60) temp.b=60;
	return temp;
}


Range happyRange2(double x,double y)
{
	Range temp;
	temp.a=(x+D-360)/y;
	temp.b=(x-D)/y;
	if (temp.a>temp.b) {
		temp.a=temp.b=0.0;
	}
	if(temp.a<0) temp.a=0;
	if(temp.b>60) temp.b=60;
	return temp;
}
